import { watch, computed } from 'vue';
import { useFavicon as usePageFavicon } from '@vueuse/core';
import { useDomainStoreWithOut } from '/@/store/modules/domain';

export function useFavicon() {
  const domainStore = useDomainStoreWithOut();
  const icon = computed(() => domainStore.getProjectInfo?.icon);

  watch(
    () => icon.value,
    (val) => {
      usePageFavicon(val);
    },
    {
      immediate: true,
    },
  );
}
